﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteNewLayout.Master" AutoEventWireup="true" CodeBehind="ProductsList.aspx.cs" Inherits="ShoppingApp.ProductsList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Showing products for CategoryID="></asp:Label>
        <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
        <hr style="color: Red; margin-left: 0px; width: 400px; text-align: left; height: 1px"/>
        <p>
            
        </p>
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ProductID" 
            DataSourceID="SqlDataSource1" GroupItemCount="2">
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <EmptyItemTemplate>
                <td runat="server" />
            </EmptyItemTemplate>
            <GroupTemplate>
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
            <ItemTemplate>
                <td runat="server" style="">
                    
                    <%--
                    ProductName:
                    <asp:Label ID="ProductNameLabel" runat="server" 
                        Text='<%# Eval("ProductName") %>' />
                    <br />Weight:
                    <asp:Label ID="WeightLabel" runat="server" Text='<%# Eval("Weight") %>' />
                    <br />Capacity:
                    <asp:Label ID="CapacityLabel" runat="server" Text='<%# Eval("Capacity") %>' />
                    <br />Items:
                    <asp:Label ID="ItemsLabel" runat="server" Text='<%# Eval("Items") %>' />
                    <br /> --%>
                    <table border="0" width="300">
                        <tr>
                            <td style="width: 25px"></td>
                            <td style="vertical-align: middle; text-align: right">
                                <a href='ProductsDetails.aspx?ProductID=<%# Eval("ProductId") %>'>
                                    <image src="Images/triangle.jpg" width="30px" height="30px" border="1"></image>
                                </a>
                                
                            </td>
                            <td style="width: 250px; vertical-align: middle">
                                <a href='ProductsDetails.aspx?ProductID=<%# Eval("ProductId") %>'><%# Eval("ProductName") %></a>
                                <br />Weight:
                                <asp:Label ID="WeightLabel" runat="server" Text='<%# Eval("Weight") %>' />
                                <br />Capacity:
                                <asp:Label ID="CapacityLabel" runat="server" Text='<%# Eval("Capacity") %>' />
                                <br />Items:
                                <asp:Label ID="ItemsLabel" runat="server" Text='<%# Eval("Items") %>' />
                                <br />
                            </td>
                        </tr>
                    </table>
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                <tr ID="groupPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ShoppingAppDbConnectionString %>" 
            SelectCommand="SELECT * FROM [tProducts] WHERE ([ProductCategoryID] = @ProductCategoryID)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ProductCategoryID" 
                    QueryStringField="CategoryId" Type="Byte" />
            </SelectParameters>
        </asp:SqlDataSource>
        
    </div>
</asp:Content>
